#include<iostream>

using namespace std;

const int N=1e6+10;

int primes[N],phi[N],cnt=0;
bool vis[N];


int main()
{
    int n;scanf("%d",&n);
    phi[1]=1;
    for(int i=2;i<=n;++i)
    {
        if(!vis[i])
        {
            primes[cnt++]=i;
            phi[i]=i-1;
        }
        for(int j=0;primes[j]<=n/i;++j)
        {
            int m=primes[j]*i;
            vis[m]=true;
            if(i%primes[j]==0)
            {
                phi[m]=primes[j]*phi[i];
                break;
            }
            else phi[m]=(primes[j]-1)*phi[i];
        }
    }
    
    long long res=0;
    for(int i=1;i<=n;++i) res+=phi[i];
    
    printf("%lld",res);
    return 0;
}